<!DOCTYPE html>
<html>
<head>
    <title>TCF Input Plugin</title>
    <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>    
    <script src="https://unpkg.com/element-plus"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vanta/0.5.24/vanta.waves.min.js"></script>
    <style>
        :root {
            --primary-color: #54586a;
            --primary-hover: #9090a9;
            --secondary-color: #6b5b6e;
            --background-dark: #0f0f23;
            --background-card: rgba(255, 255, 255, 0.05);
            --background-card-hover: rgba(255, 255, 255, 0.08);
            --text-primary: #ffffff;
            --text-secondary: rgba(255, 255, 255, 0.7);
            --border-color: rgba(255, 255, 255, 0.1);
            --success-color: #10b981;
            --warning-color: #f59e0b;
            --error-color: #ef4444;
            --info-color: #3b82f6;
        }
        
        * {
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            
            color: var(--text-primary);
            margin: 0;
            padding: 30px 0 0 0;
            min-height: 100vh;
            line-height: 1.6;
        }
        
        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 32px;
            background: var(--background-card);
            backdrop-filter: blur(5px);
            border: 1px solid var(--border-color);
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
            border-radius: 20px;
            margin-top: 20px;
            transition: all 0.3s ease;
        }
        
        .container:hover {
            transform: translateY(-2px);
            box-shadow: 0 35px 60px rgba(0, 0, 0, 0.3);
        }
        h2 {
            text-align: center;
            color: var(--text-primary);
            font-size: 2.5rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            margin-bottom: 40px;
            position: relative;
        }
        
        h2::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 60px;
            height: 3px;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            border-radius: 2px;
        }
        
        h3 {
            color: var(--text-primary);
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        h3::before {
            content: '';
            width: 4px;
            height: 20px;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            border-radius: 2px;
        }
        
        .settings-section, .input-section {
            margin-bottom: 40px;
            padding: 24px;
            background: var(--background-card-hover);
            border-radius: 16px;
            border: 1px solid var(--border-color);
            transition: all 0.3s ease;
        }
        
        .settings-section:hover, .input-section:hover {
            background: rgba(255, 255, 255, 0.1);
            transform: translateY(-1px);
        }
        
        .input-group {
            display: flex;
            margin-bottom: 20px;
            align-items: center;
            flex-wrap: wrap;
            gap: 16px;
        }
        
        input, textarea {
            flex: 1;
            min-width: 200px;
            padding: 14px 16px;
            background: rgba(255, 255, 255, 0.08);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            font-size: 14px;
            color: var(--text-primary);
            transition: all 0.3s ease;
            font-family: inherit;
        }
        
        textarea {
            resize: vertical;
            min-height: 120px;
            line-height: 1.5;
        }
        input:focus, textarea:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 0 20px rgba(102, 126, 234, 0.2);
            background: rgba(255, 255, 255, 0.12);
        }
        
        input::placeholder, textarea::placeholder {
            color: var(--text-secondary);
        }
        
        button {
            padding: 14px 28px;
            background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
            color: white;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 600;
            font-size: 14px;
            font-family: inherit;
            min-width: 140px;
            position: relative;
            overflow: hidden;
        }
        
        button::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }
        
        button:hover::before {
            left: 100%;
        }
        button:hover {
            background: linear-gradient(135deg, var(--primary-hover), var(--secondary-color));
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
        }
        
        button:active {
            transform: translateY(0);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
        }
        
        button:disabled {
            background: rgba(255, 255, 255, 0.1);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
            opacity: 0.6;
        }
        
        button:disabled::before {
            display: none;
        }
        #output {
            margin-top: 40px;
        }
        
        .status {
            padding: 20px;
            margin-bottom: 16px;
            border-radius: 16px;
            background: var(--background-card-hover);
            border: 1px solid var(--border-color);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .status::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            border-radius: 0 2px 2px 0;
        }
        
        .status:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
            background: rgba(255, 255, 255, 0.1);
        }
        
        .status-info::before {
            background: var(--info-color);
        }
        
        .status-success::before {
            background: var(--success-color);
        }
        
        .status-error::before {
            background: var(--error-color);
        }
        
        .status-warning::before {
            background: var(--warning-color);
        }
        .progress-container {
            width: 100%;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            margin-bottom: 24px;
            display: none;
            overflow: hidden;
            height: 12px;
            border: 1px solid var(--border-color);
        }
        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
            border-radius: 12px;
            width: 0%;
            transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
            position: relative;
        }
        
        .progress-bar::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            animation: shimmer 2s infinite;
        }
        
        @keyframes shimmer {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }
        pre {
            background: var(--background-card-hover);
            padding: 20px;
            border-radius: 16px;
            overflow-x: auto;
            font-size: 13px;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            margin-top: 16px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            line-height: 1.6;
            backdrop-filter: blur(10px);
        }
        
        .data-table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 24px;
            background: var(--background-card-hover);
            border-radius: 16px;
            overflow: hidden;
            border: 1px solid var(--border-color);
            backdrop-filter: blur(10px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        
        .data-table th, .data-table td {
            border: none;
            border-bottom: 1px solid var(--border-color);
            padding: 16px 20px;
            text-align: left;
            transition: all 0.3s ease;
        }
        
        .data-table th {
            background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
            color: white;
            font-weight: 600;
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            position: relative;
        }
        
        .data-table th::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: var(--secondary-color);
        }
        
        .data-table tbody tr {
            transition: all 0.3s ease;
        }
        
        .data-table tbody tr:nth-child(even) {
            background: rgba(255, 255, 255, 0.03);
        }
        
        .data-table tbody tr:hover {
            background: rgba(255, 255, 255, 0.08);
            transform: scale(1.01);
        }
        
        .data-table td {
            color: var(--text-primary);
            font-size: 14px;
        }
        
        /* 窗口控制按钮样式 */
        .drag-region {
            display: flex;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 30px;
            -webkit-app-region: drag;
            background: transparent;
            justify-content: flex-end;
            align-items: center;
            padding-right: 10px;
            z-index: 9999;
        }
        
        .drag-region button {
            width: 40px;
            margin-left: -5px;
            border: 0;
            outline: 0;
            background: transparent;
            transition: 0.2s;
            -webkit-app-region: no-drag;
            height: auto;
            display: inline-block;
            min-width: auto;
            box-sizing: content-box;
            padding: 0;
        }
        
        .drag-region button:hover {
            background-color: transparent;
            transform: none;
            box-shadow: none;
        }
        
        .drag-region button svg path,
        .drag-region button svg rect,
        .drag-region button svg polygon {
            fill: #ffffff;
        }
        
        .drag-region button svg {
            width: 10px;
            height: 10px;
        }
        
        .drag-region .close:hover svg polygon {
            fill: #ff0000;
        }
        
        .drag-region .maximize:hover svg path {
            fill: #53535f;
        }
        
        .drag-region .minimize:hover svg rect {
            fill: #53535f;
        }
        
        /* 动态背景容器 */
        .vanta-container {
            width: 100%;
            height: 100vh; /* 占据整个视口的高度 */
            position: fixed;
            top: 0;
            left: 0;
            z-index: -1;
        }
        
        /* 详情元素样式 */
        details {
            margin-top: 15px;
            border-radius: 7px;
            overflow: hidden;
            background-color: rgba(255, 255, 255, 0.05);
        }
        
        summary {
            padding: 12px 15px;
            cursor: pointer;
            background-color: rgba(83, 83, 95, 0.5);
            color: #fff;
            font-weight: 500;
            transition: all 0.3s ease;
        }
        
        summary:hover {
            background-color: rgba(83, 83, 95, 0.8);
        }
        
        /* 添加动画效果 */
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .status, .data-table, details {
            animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .input-group {
            animation: slideIn 0.5s ease-out;
        }
        
        .settings-section, .input-section {
             animation: fadeIn 0.8s ease-out;
         }
         
         /* 响应式设计 */
         @media (max-width: 768px) {
             .container {
                 margin: 10px;
                 padding: 20px;
                 border-radius: 16px;
             }
             
             h2 {
                 font-size: 2rem;
             }
             
             .input-group {
                 flex-direction: column;
                 align-items: stretch;
             }
             
             input, textarea, button {
                 width: 100%;
                 min-width: unset;
             }
             
             .settings-section, .input-section {
                 padding: 16px;
             }
             
             .data-table {
                 font-size: 12px;
             }
             
             .data-table th, .data-table td {
                 padding: 12px 8px;
             }
         }
         
         @media (max-width: 480px) {
             body {
                 padding: 10px 0 0 0;
             }
             
             .container {
                 margin: 5px;
                 padding: 16px;
             }
             
             h2 {
                 font-size: 1.75rem;
             }
             
             h3 {
                 font-size: 1.1rem;
             }
         }
         
         /* 滚动条样式 */
         ::-webkit-scrollbar {
             width: 8px;
         }
         
         ::-webkit-scrollbar-track {
             background: rgba(255, 255, 255, 0.1);
             border-radius: 4px;
         }
         
         ::-webkit-scrollbar-thumb {
             background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
             border-radius: 4px;
         }
         
         ::-webkit-scrollbar-thumb:hover {
             background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
         }
     </style>
</head>
<body>
    <div id="vantaRef" class="vanta-container"></div>
    
    <div class="container">
        <h2>TCF Input Automation</h2>
        
        <!-- 账号设置区域 -->
        <div class="settings-section">
            <h3>账号设置</h3>
            <div class="input-group" style="flex-direction: column; align-items: stretch; gap: 15px;">
                <details open>
                    <summary>TCF 凭证 (http://cnap452:10674/#/)</summary>
                    <div class="input-group" style="padding-top: 15px; margin-bottom: 0;">
                        <input type="text" id="apiUsername" placeholder="TCF 用户名" value="XFR9319274">
                        <input type="password" id="apiPassword" placeholder="TCF 密码" value="Password@123456">
                    </div>
                </details>
                <details>
                    <summary>Auchan 凭证 (https://centric8.sncoia.com/WebAccess/login.html)</summary>
                    <div class="input-group" style="padding-top: 15px; margin-bottom: 0;">
                        <input type="text" id="extractionUsername" placeholder="Auchan 用户名" value="XFR9319274">
                        <input type="password" id="extractionPassword" placeholder="Auchan 密码" value="Password@123456">
                    </div>
                </details>
            </div>
        </div>
        
        <!-- 单号输入区域 -->
        <div class="input-section">
            <h3>单号处理</h3>
            <div class="input-group">
                <textarea id="orderNumbers" placeholder="请输入单号, 支持多个单号(每行一个) 💡 提示: Enter 换行，Shift+Enter 开始处理
例如:
P17-104-AIR-AIR14935
P17-105-AIR-AIR14936
P17-106-AIR-AIR14937
"
 rows="4"></textarea>
            </div>
            <div class="input-group">
                <button id="runAutomation">开始处理</button>
                <button id="clearResults">清空结果</button>
            </div>
        </div>
        
        <div class="progress-container" id="progressContainer">
            <div class="progress-bar" id="progressBar"></div>
        </div>
        
        <div id="output"></div>
    </div>
    
    <script src="tcf-input.js"></script>
    <script>
        // 添加窗口控制按钮
        if (window.htmlUIAPI) {
            window.htmlUIAPI.injectWindowControls();
        }
        
        // 初始化 Vanta 背景
        if (typeof VANTA !== 'undefined') {
            VANTA.WAVES({
                el: "#vantaRef",
                mouseControls: true,
                touchControls: true,
                gyroControls: false,
                minHeight: 200.00,
                minWidth: 200.00,
                scale: 1.00,
                scaleMobile: 1.00,
                color: 0x5588,
                shininess: 35.00,
                waveHeight: 15.00,
                waveSpeed: 0.75,
                zoom: 0.65
            });
        }
    </script>
</body>
</html>
